<template>
    <view :class="['coupon-item', active ? 'active' : 'unactive']">
        <view class="discount-money">
            <view class="price" v-if="coupon.discount_type === 0">
                <text class="unit">¥</text>
                <text class="money">{{ coupon.discount_money / 100 }}</text>
            </view>
            <block v-else>
                <view class="price" v-if="coupon.discount_type === 1">
                    <text>{{ coupon.discount_rate / 10 }}</text>
                    <text class="unit">折</text>
                </view>
                <block v-else>
                    <view class="price" v-if="coupon.discount_type === 2">
                        <text>包邮</text>
                    </view>
                    <block v-else>
                        <view class="price small" v-if="coupon.discount_type === 3">
                            <text>兑换券</text>
                        </view>
                    </block>
                </block>
            </block>
        </view>
        <view class="detail">
            <view class="title">
                <text>{{ coupon.title }}</text>
            </view>
            <view class="valid-date">
                <text v-if="coupon.time_limit_type == 0">{{ validDateStr }}</text>
                <block v-else>
                    <text v-if="coupon.time_limit_type == 1">{{ '领取后' + coupon.valid_time + '小时内有效' }}</text>
                </block>
            </view>
        </view>
        <view class="label" v-if="coupon.score_price">
            <text v-if="coupon.score_price">{{ coupon.score_price + scoreAlias + '兑换' }}</text>
        </view>
    </view>
</template>

<script>
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/CouponPopup/CouponItem'],
    {
        '4e3d': function (t, n, e) {
            'use strict';

            Object.defineProperty(n, '__esModule', {
                value: true
            });
            n.default = void 0;
            var o = {
                name: 'CouponItem',
                props: {
                    coupon: {
                        type: Object,
                        default: function () {
                            return {};
                        }
                    },
                    active: {
                        type: Number,
                        default: 1
                    },
                    activeText: {
                        type: String,
                        default: '立即使用'
                    },
                    unActiveText: {
                        type: String,
                        default: '已使用'
                    }
                },
                computed: {
                    validDateStr: function () {
                        return this.coupon
                            ? 0 != this.coupon.time_limit_type
                                ? ''
                                : this.coupon.usable_start_at.substr(0, 10) + ' 至 ' + this.coupon.usable_end_at.substr(0, 10)
                            : '';
                    }
                },
                methods: {
                    click: function () {}
                }
            };
            n.default = o;
        },
        '4e71': function (t, n, e) {},
        '8d60': function (t, n, e) {
            'use strict';

            e.r(n);
            var o = e('4e3d');
            var u = e.n(o);
            for (var c in o) {
                if (['default'].indexOf(c) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return o[t];
                        });
                    })(c);
                }
            }
            n.default = u.a;
        },
        bdeb: function (t, n, e) {
            'use strict';

            e.d(n, 'b', function () {
                return o;
            });
            e.d(n, 'c', function () {
                return u;
            });
            e.d(n, 'a', function () {});
            var o = function () {
                this.$createElement;
                this._self._c;
            };
            var u = [];
        },
        bf98: function (t, n, e) {
            'use strict';

            e.r(n);
            var o = e('bdeb');
            var u = e('8d60');
            for (var c in u) {
                if (['default'].indexOf(c) < 0) {
                    (function (t) {
                        e.d(n, t, function () {
                            return u[t];
                        });
                    })(c);
                }
            }
            e('dbfa');
            var a = e('f0c5');
            var p = Object(a.a)(u.default, o.b, o.c, false, null, null, null, false, o.a, void 0);
            n.default = p.exports;
        },
        dbfa: function (t, n, e) {
            'use strict';

            var o = e('4e71');
            e.n(o).a;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/CouponPopup/CouponItem-create-component',
    {
        'components/CouponPopup/CouponItem-create-component': function (t, n, e) {
            e('543d').createComponent(e('bf98'));
        }
    },
    [['components/CouponPopup/CouponItem-create-component']]
]);
</script>
<style>
@import './CouponItem.css';
</style>
